package com.one.consumer.reserve.presenter;

import android.content.Context;

import com.one.common.model.extra.DefaultExtra;
import com.one.common.model.http.callback.ObserverOnResultListener;
import com.one.common.presenter.BaseApiPresenter;
import com.one.common.view.base.BaseActivity;
import com.one.consumer.reserve.model.ReserveModel;
import com.one.consumer.reserve.model.item.CustomItem;
import com.one.consumer.reserve.ui.view.DetailView;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/10/27 2:21 PM
 * description ：预约详情 定制加配
 **/
public class CustomDetailPresenter extends BaseApiPresenter<DetailView<CustomItem>,ReserveModel> {

    private DefaultExtra extra;
    public CustomDetailPresenter(DetailView mView, Context mContext) {
        super(mView, mContext, new ReserveModel((BaseActivity) mContext));
    }

    @Override
    public void onCreate() {
        super.onCreate();
        extra = (DefaultExtra) mActivity.getIntent().getSerializableExtra(DefaultExtra.getExtraName());
        getDetail();
    }

    /**
     * 获取 设计，装修预约订单详情
     */
    public void getDetail(){
        mModel.getCustomDetail(extra.getStr(), new ObserverOnResultListener<CustomItem>() {
            @Override
            public void onResult(CustomItem customItem) {
                mView.setDetail(customItem);
            }
        });
    }

}
